package com.alibaba.shopping_seckill_service.redis;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;

/**
 * @ClassName RedisListenerConfig
 * @Description TODO
 * @Author Leo
 * @Date 2024/12/23 09:50
 */
@Configuration
public class RedisListenerConfig {

    // 注入Redis监听器，监听过期事件
    @Bean
    public RedisMessageListenerContainer listenerContainer(RedisConnectionFactory connectionFactory){
        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
        container.setConnectionFactory(connectionFactory);
        return container;
    }
}




